//
//  PayModeView.m
//  EasyToTesco2.0
//
//  Created by 杨森 on 16/6/11.
//  Copyright © 2016年 EasyToTesco. All rights reserved.
//

#import "PayModeView.h"

@implementation PayModeView

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        
        //适配
        CGFloat plusCount;
        if (iPhone5 ) {
            plusCount = 10;
        }else {
            plusCount = 15;
        }
        
        UILabel *Label = [[UILabel alloc] initWithFrame:CGRectMake(15,plusCount,100,14)];
        Label.text = @"温馨提示";
        Label.font = [UIFont systemFontOfSize:14];
        [self addSubview:Label];
        Label.font = [UIFont fontWithName:@ "Arial Rounded MT Bold"  size:(14.0)];
        Label.textColor = [UIColor grayColor];
        
        NSArray *ARRAY = @[@"· 请仔细核对充值号码,充值好将无法退款", @"· 本充值无法提供发票", @"· 充值订单一经提交不可取消或修改", @"· 请务必确认需充值的手机号无误", @"· 每个会员号每日限充两百",@"· 请谨慎购买"];
        
        self.backgroundColor = [UIColor whiteColor];
        UILabel *tishiLabel;
        for (NSInteger i = 0; i<ARRAY.count; i++) {
            tishiLabel = [[UILabel alloc] initWithFrame:CGRectMake(15,CGRectGetMaxY(Label.frame)+25*i+plusCount, WIDTH-20, 20)];
            tishiLabel.textColor = [UIColor grayColor];
            tishiLabel.text = ARRAY[i];
            tishiLabel.font = [UIFont systemFontOfSize:13];
            tishiLabel.font = [UIFont fontWithName:@ "Arial Rounded MT Bold"  size:(13.0)];
            [self addSubview:tishiLabel];
        }
        
        UIButton *rechargeBtn = [[UIButton alloc] initWithFrame:CGRectMake(15,CGRectGetMaxY(tishiLabel.frame)+20,WIDTH-30,40)];
        rechargeBtn.tag = 999;
        [rechargeBtn setTitle:@"立即充值" forState:UIControlStateNormal];
        [self addSubview:rechargeBtn];
        rechargeBtn.layer.cornerRadius = 5;
        rechargeBtn.layer.masksToBounds = YES;
        rechargeBtn.titleLabel.font = [UIFont systemFontOfSize:15];
        [rechargeBtn setBackgroundColor:DEFAULT_COLOR];
        
        [rechargeBtn addTarget:self action:@selector(nowRechargeDidClick) forControlEvents:UIControlEventTouchUpInside];
        
        
        
    }
    return self;
}

-(void)nowRechargeDidClick
{
    if ([self.delegate respondsToSelector:@selector(payModeViewDidClick)]) {
        [self.delegate payModeViewDidClick];
    }
}

@end
